/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: jse2204 - Op3
 * <p>Powered by webrx On 2022-08-30 09:06:33
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Op3 {
    public static void main(String[] args) {

        //短路机制
        int i = 5;
        System.out.println((++i == 7) && (++i==7)); //有短路false
        System.out.println(i);//6

        //没有短路
        System.out.println((++i == 17) & (++i==7)); //false
        System.out.println(i);//8

        //&& 与 支持短路
        System.out.println(!false && !true);
        System.out.println(true&&true);
        System.out.println(true&&false);
        System.out.println(false&&false);
        System.out.println(false&&true);
        System.out.println(false == false);

        //& 逻辑与 （不支持短路
        System.out.println("---------------------------------- &");
        System.out.println(!false & !true);
        System.out.println(true&true);
        System.out.println(true&false);
        System.out.println(false&false);
        System.out.println(false&true);
        System.out.println(false == false);


        System.out.println("---------------------------------- ||");
        //|| 或
        System.out.println(!false || !true);
        System.out.println(true||true);
        System.out.println(true||false);
        System.out.println(false||false);
        System.out.println(false||true);

        //! 非
        System.out.println("---------------------------------- !");
        System.out.println(!!!!true == false);
        System.out.println(!(true||false));

        //^ 异域
        System.out.println("---------------------------------- ^");
        System.out.println(false ^ true);
        System.out.println(true ^ false);
        System.out.println(false ^ false);
        System.out.println(true ^ true);
    }
}
